05. Efficent division by a power of 2: Efficient Division by a Power of 2
Description
divp2 efficiently divides an object of class vli by a power of 2.
Usage
# S3 method for vli
divp2(x, k)
# S3 method for default
divp2(x, k)
# S3 method for numeric
divp2(x, k)
# S3 method for vli
divp2(x, k)
Value
object of class vli
Arguments
x
dividend; object of class vli or 32 bits integer
k
exponent of the divisor (the divisor will be 2^k); 32 bits integer
Author
Javier Leiva Cuadrado
Details
Given two integers x (vli or 32 bits integer) and k (32 bits integer), the function divp2(x, k) computes and returns x/(2^k) as an object of class vli.